<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.打印0-20之间的整数, 将每个数输出到控制台
        let i = 0
        while (i <= 20) {
            console.log(i);
            i++
        }
        //2.计算1-1000之间的和
        let sum = 0
        for (let i = 1; i <= 1000; i++) {
            sum += i
        }
        console.log(sum);
        //3.打印 100-200之间,可以被6整除的数字
        for (let i = 100; i <= 200; i++) {
            if (i % 6 === 0) {
                document.write(`<p>${i}</p>`);
            }
        }
        // 4.用户输入一个数，  计算 1 到这个数的和
        let num = Number(prompt('请输入一个数字'))
        let sum1 = 0
        for (let i = 1; i <= num; i++) {
            sum1 += i
        }
        console.log(sum1);
    </script>
</body>

</html>